<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport"
          content="width=device-width,user-scalable=no, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>团队简介</title>
    <%- include('./_global/baseLibs') %>
    <link rel="stylesheet"  href="/static/css/mycontract.css" />
    <link href="/static/css/page-main.css" rel="stylesheet"/>
    <style type="text/css">
        .team-profile .first-box{
            height: auto;
            overflow: hidden;
        }
    </style>
</head>
<body>
<section class="page-wrap team-profile">
    <header class="header-box grey fixed">
        <div class="header-content">
            <div class="left-tool">
                <a class="back" href="javascript:void(0);"><i class="iconfont icon-back"></i></a>
            </div>
            <div class="title">团队简介</div>
        </div>
    </header>
    <div id="TDXX">
        <div class="first-box">
            <img src="/static/images/doctors.png">
            <div class="text-box">
                <span class="blue-text" name="tdmc">中心团队</span>
                <span name="yljgmc"></span>
                <span name="jglb"></span>
                <span name="cjsj"></span>
            </div>
            <a class="yqy-btn" id="yqy-btn">预签约</a>
        </div>
        <div class="jj-box">
            <p class="jj-title">简介：</p>
            <span class="jj-content" name="tdjj"></span>
            <a class="zz-btn">展开</a>
        </div>
    </div>
    <div class="member-box">
        <div class="member-title"><span>团队成员</span></div>
        <div class="doctor-list-box">
            <ul id="tdcy">
            </ul>
        </div>
    </div>


</section>

<script type="text/html" id="ysLi">
    <li>
        <a href="javascript:void(0);">
            <img src="/static/images/doctor_image.jpg">
            <div class="text-box">
                <h4 class="h4-title">
                    <span class="name" name="xm"></span>
                    <span name="ksmc"></span>
                    <span name="zcmc"></span>
                </h4>
                <p name="yljgmc"></p>
            </div>
            <div class="item-after"><i class="iconfont icon-more"></i></div>
        </a>
    </li>
</script>

<script type="text/javascript">


    var page_tdjj = (function($, page_tdjj) {

        var tdxx_xzqhdm = "";
        tdxx_xzqhdm = StoreCache.removeCache("xzqhdm");

        function initView() {
            /**简介展开收起*/
            var slide=true;
            $(".zz-btn").click(function () {
                if (slide==true) {
                    $(this).html("收起").prev(".jj-content").hide();
                    slide=false;
                } else {
                    $(this).html("展开").prev(".jj-content").show();
                    slide=true;
                }
            });
            /**预签约按钮*/
            $("#yqy-btn").on("click", function () {
                var QYFW_HZXX = StoreCache.getCache("jkcsUserInfo");
                console.log(QYFW_HZXX.name);
                console.log(QYFW_HZXX.patientCardId);
                if (QYFW_HZXX.xm && QYFW_HZXX.sfzh) {
                    $.QuickUrlUtils.redirectJSBridge({
                        url: "/html/gzd/signService/xzfwtc.html?xzqhdm=" + tdxx_xzqhdm,
                        title: "选择服务套餐",
                        "app_user_agent": "qyfw"
                    });
                    // $.pageSwitch.goToUrl("mySignService","xzfwtc");
                } else {
                    $.QuickAlert.alertConfirm({
                        content: "未查到用户信息，请在家人列表补充本人信息！", btn: ["现在就去", "以后再说"], callback: function () {
                            $.pageSwitch.goToUrl("family","familyAdd");
                        }
                    });
                }
            });
        }

        function initData() {
            /**团队信息*/
            var tdxx = StoreCache.getCache("QYFW_TDXX");
            console.log(tdxx);
            page_tdjj.setTdxx(tdxx);
            page_tdjj.queryYsxx();
        }

        /**设置团队信息*/
        function setTdxx(tdxx) {
            /**格式化创建时间*/
            var cjsj = tdxx["cjsj"];
            cjsj = cjsj.stringToDate().Format("yyyy-MM-dd");
            tdxx["cjsj"] = cjsj + "成立";
            if (tdxx["YYXX"] != undefined) {
                tdxx["YYXX"] = tdxx["YYXX"].substr(0, tdxx["YYXX"].indexOf("("));
            }

            $("#TDXX").data(tdxx);
            $("#TDXX").find("span[name]").each(function () {
                var name = $(this).attr("name");
                var text = tdxx[name];
                $(this).text(text);
            })
        }

        /**查询团队医生信息 */
        function queryYsxx() {
            var tdxx = $("#TDXX").data();
            var yydm = tdxx["xzqhdm"];
            var tddm = tdxx["tdid"];
            $.QuickRemote.AjaxJson({
                funcName:"/api/gzd/qyfw/queryTdcyListToJkcs"
                ,callback: function (result) {
                    var ds = eval(result);
                    page_tdjj.createYsItem(ds);
                }
                ,params:{ tdid: tddm}
            });
        }

        /**创建医生列表*/
        function createYsItem(ary) {
            if (ary) {
                $.each(ary, function (index, item) {
                    var tdxx = $("#TDXX").data();
                    // tdxx_xzqhdm = tdxx_xzqhdm || item.xzqhdm;
//                console.log(tdxx);
                    item["YLJGMC"] = tdxx["YLJGMC"];
                    var ysxx = $($("#ysLi").html());
                    $(ysxx).find("p[name],span[name]").each(function () {
                        var name = $(this).attr("name");
                        var text = item[name];
                        $(this).text(text);
                    });
                    ysxx.click(function () {
                        page_tdjj.viewYsxx(item);
                    });
                    $("#tdcy").append(ysxx);
                });
            }
        }

        /**  点击医生列表，跳转查看医生信息  */
        function viewYsxx(item) {
            item.photo = "/static/images/doctor_image.jpg";

            StoreCache.setCache("qyfwYsjj", JSON.stringify(item));
            $.pageSwitch.goToUrl("mySignService","ysjj");
        }

        var cfg_def = {
            initView: initView,
            initData: initData,
            setTdxx: setTdxx,
            queryYsxx: queryYsxx,
            createYsItem: createYsItem,
            viewYsxx: viewYsxx,
        }

        page_tdjj.init = function(cfg){
            $.extend(page_tdjj, cfg_def, cfg);
            page_tdjj.initView();
            page_tdjj.initData();
            $('.zz-btn').click(function () {
                if ($(this).html() == "展开") {
                    $(this).html("收起");
                    $(".jj-content").css('webkit-line-clamp', '9999');
                } else if ($(this).html() == "收起") {
                    $(this).html("展开");
                    $(".jj-content").css('webkit-line-clamp', '3');
                }
            });

        }

        return page_tdjj;
    })(jQuery, {});

    


</script>

</body>
</html>